package com.monitor.app_monitor.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

@Configuration
public class PlatformConfiguration {

    @Bean
    public ThreadPoolExecutor dataAnalysisThreadPool() {
        return new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(),
          //5, 10, TimeUnit.MINUTES, new LinkedBlockingDeque<>());
                Runtime.getRuntime().availableProcessors() * 2, 10, TimeUnit.MINUTES, new LinkedBlockingDeque<>());
    }

    @Bean
    public ThreadPoolExecutor spcThreadPool() {
        return new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(),
                //5, 10, TimeUnit.MINUTES, new LinkedBlockingDeque<>());
                Runtime.getRuntime().availableProcessors() * 2, 10, TimeUnit.MINUTES, new LinkedBlockingDeque<>());
    }
}